home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 April
/
CHIP CD (4 - 2007).iso
/
beeld
/
3d
/
ArtOfIllusion24-Mac.dmg
/
Art of Illusion
/
ArtOfIllusion.jar
/
bsh
/
commands
/
editor.bsh
< prev
next >
Wrap
Text File
|
2005-05-23
|
1KB
|
50 lines
/**
Open a GUI editor from the command line or in the GUI desktop mode.
When run from the command line the editor is a simple standalone
frame. When run inside the GUI desktop it is a workspace editor.
See workspaceEditor()
*/
bsh.help.editor = "usage: editor()";
import java.awt.*;
editor()
{
if ( bsh.system.desktop != void ) {
return workspaceEditor( this.interpreter );
}
this.ta = new TextArea(15,40);
this.frame = new Frame("Editor");
frame.add(ta, "Center");
this.p = new Panel();
this.b = new Button("Eval");
b.addActionListener(this);
p.add(b);
b = new Button("Clear");
b.addActionListener(this);
p.add(b);
b = new Button("Close");
b.addActionListener(this);
p.add(b);
frame.add(p, "South");
frame.pack();
frame.show();
actionPerformed(e)
{
if ( e.getActionCommand().equals("Close") )
frame.dispose();
else if ( e.getActionCommand().equals("Clear") )
ta.setText("");
else
this.interpreter.eval( ta.getText() );
}
print("Editor started...");
return frame;
}